package com.manager.cms.config.security;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;

/**
 * 自定义SecurityContextHolder,便于封装
 *
 */
public class SecurityContextHolderSimple extends SecurityContextHolder {

    public static UserDetails userDetails(){
        Authentication authentication = SecurityContextHolderSimple.getContext().getAuthentication();
        UserDetails userDetails = (UserDetails) authentication.getPrincipal();
        return userDetails;
    }
}
